<template>
  <header class="header">
      <h1>todos</h1>
      <input class="new-todo" placeholder="请输入任务名称" autofocus  v-model.trim="shuru" @keyup.enter="fn"/>
    </header>
</template>

<script>
 export default {
   name: 'TodoHeader',
   props: {
   },
     data() {
    return {
      shuru:'',
    }
  },
  methods:{
    fn(){
        if(!this.shuru.length) return
        this.$emit('fn',this.shuru)
        this.shuru=''
    }
  }
 }
</script>

<style scoped lang='less'>

</style>